package com.allwees.bs.c.module.order.context.listener;

import com.allwees.bs.c.module.ops.service.UserCouponService;
import com.allwees.bs.c.module.order.context.event.InviteeFirstPayedOrderEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 订单支付成功Listener
 *
 * @author yangylsky
 * @since 2019-08-17
 *
 */
@Slf4j
@Component
public class InviteeFirstPayedOrderListener {

	@Autowired
	private UserCouponService userCouponService;

	@Async
	@TransactionalEventListener
	public void onInviteeFirstPayedOrder(InviteeFirstPayedOrderEvent event) {

		String inviterUuid = (String) event.getSource();

		log.info("reveive invitee first payed order event[inviterUuid:{}]", inviterUuid);

		inviteeFirstPayedOrder(inviterUuid);
	}

	private void inviteeFirstPayedOrder(String inviterUuid) {
		//userCouponService.inviteeFirstPayedOrderReceive(inviterUuid);
	}
}
